﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;
using System.Collections;
using Jbe.TestSuite.LogViewer.Properties;

namespace Jbe.TestSuite.LogViewer.Presentation
{
    internal class LogEntriesCountConverter : IValueConverter
    {
        private static readonly LogEntriesCountConverter @default = new LogEntriesCountConverter();


        public static LogEntriesCountConverter Default { get { return @default; } }


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int) 
            {
                int count = (int)value;
                if (count == 1)
                {
                    return string.Format(culture, Resources.EntryCount, count);
                }
                else
                {
                    return string.Format(culture, Resources.EntriesCount, count);
                }
            }
            throw new NotSupportedException();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
